Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unify real expression in U{FreeIdent,Repeated}Test #32

Conversation

rickie
Copy link
Member

@rickie rickie commented Jun 7, 2022

❗ This PR is on top of #4

In #4 we introduce additional logic to filter out invalid expressions in UFreeIdent, see here.
However, when this code got introduced in this commit c2e14f2, it broke our code.

The test cases in the UFreeIdentTest and URepeatedTest are not "valid"/"realistic" enough and therefore results in an IllegalArgumentException in ASTHelpers#getSymbol(MethodInvocationTree).

To make our code compatible with this change, we changed the tests to use BugCheckers for the two tests. This way we can use the same assertions but use real expressions that are accepted by ASTHelpers#getSymbol.

Once we merge this PR we can also rebase #4 with master.

@rickie rickie requested a review from Stephan202 June 7, 2022 08:12
Copy link
Member Author

@rickie rickie left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Some context.

}

@BugPattern(
name = "UnificationChecker",
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

After merging the PR, we can rebase it and also drop the name field here and below.

@rickie rickie force-pushed the rossendrijver/refaster_simple_return_fix branch from 45120d2 to 20508e2 Compare June 9, 2022 08:02
@rickie
Copy link
Member Author

rickie commented Jun 27, 2022

@Stephan202 , do you have time for a last pass? (We already discussed this twice offline 😄, I think it is good to go)

Copy link
Member

@Stephan202 Stephan202 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sorry for my tardiness; added a commit :)

Unifier unifier = new Unifier(new Context());
UFreeIdent ident = UFreeIdent.create("foo");

assertThat(ident.unify(tree.getExpression(), unifier)).isNotNull();
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We can avoid the .getExpression() calls if we use a MethodInvocationTreeMatcher instead.

@rickie rickie merged commit 3b86713 into rossendrijver/refaster_simple_return Jul 4, 2022
@rickie rickie deleted the rossendrijver/refaster_simple_return_fix branch July 4, 2022 10:46
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

2 participants